<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:jsf="http://xmlns.jcp.org/jsf" xmlns:p="http://primefaces.org/ui">
<f:view>
	<f:metadata>
		<f:viewAction action="#{menuMB.updateMenu(10)}" />
	</f:metadata>
	<ui:composition template="/WEB-INF/templates/defaultLayout.xhtml">

		<!-- Definiendo la cabecera de la pagina -->
		<ui:define name="title">
			<h:outputText value="Transacción" />
		</ui:define>

		<!-- Definiendo el cuerpo de la pagina -->
		<ui:define name="content">

			<h:outputStylesheet library="css" name="main.css" />

			<h:panelGroup rendered="#{transaccionBovedaBean.failure}">
				<h:form>
					<div class="p6n-api-access-in-page-error" style="left: 516px;">
						<div>
							<div>
								<p>
									<h:messages />
								</p>
							</div>
							<div style="text-align: center;">
								<h:commandLink value="Volver"
									action="/jefeCaja/boveda/operaciones/transaccion?faces-redirect=true"
									styleClass="p6n-api-access-in-page-error-link" />
							</div>
						</div>
					</div>
				</h:form>
			</h:panelGroup>

			<h:form id="formTransaccion">
				<br />
				<div style="margin-left: 50px;">
					<div>
						<div>
							<div class="p6n-api-consent-screen-title">
								<h:outputText value="TRANSACCIÓN BOVEDA"
									rendered="#{!transaccionBovedaBean.success}">
								</h:outputText>
							</div>

							<h:panelGroup rendered="#{transaccionBovedaBean.success}">
								<div>
									<div>
										<div>
											<h:panelGroup id="voucherBoveda">
												<table
													style="width: 420px; border: solid 1px #E9E6E6; margin-bottom: 0px;">
													<tr style="vertical-align: center;">
														<td colspan="1"
															style="text-align: center; font-weight: bold; font-size: 12px;">
															<p:graphicImage name="logo_coop_voucher.png"
																library="images/logo_coop" />
														</td>
														<td colspan="3"
															style="text-align: center; font-weight: bold; font-size: 14px; vertical-align: middle">
															<h:outputText value="C.A.C." />
															<br />
															<h:outputText style="font-size: 24px;" value="CAJA VENTURA" />
														</td>
													</tr>
													<tr style="vertical-align: center;">
														<td colspan="4"
															style="text-align: center; font-weight: bold; font-size: 13px;">TRANSACCIÓN
															BOVEDA</td>
													</tr>
													<tr>
														<td style="font-weight: bold; font-size: 12px;"
															colspan="1">AGENCIA:</td>
														<td colspan="1">#{transaccionBovedaBean.agenciaBean.agencia.abreviatura}</td>
														<td style="font-weight: bold; font-size: 12px; text-align: right;"
															colspan="1">Nº TRANS:</td>
														<td colspan="1">#{transaccionBovedaBean.voucherBovedaView.idTransaccionboveda}</td>
													</tr>
													<tr>
														<td colspan="1"
															style="width: 20%; font-weight: bold; font-size: 12px;">FECHA:</td>
														<td colspan="1" style="width: 35%; font-size: 12px;"><h:outputText
																value="#{transaccionBovedaBean.voucherBovedaView.fechaTransaccionboveda}">
																<f:convertDateTime pattern="dd/MM/yyyy"/>
															</h:outputText></td>
														<td colspan="1"
															style="width: 20%; font-weight: bold; font-size: 12px; text-align: right;">HORA:</td>
														<td colspan="1" style="width: 25%; font-size: 12px;"><h:outputText
																value="#{transaccionBovedaBean.voucherBovedaView.horaTransaccionboveda}">
																<f:convertDateTime dateStyle="full" timeZone="EST"
																	type="time" />
															</h:outputText></td>
													</tr>
													<tr>
														<td colspan="1"
															style="font-weight: bold; font-size: 12px;">MONEDA:</td>
														<td colspan="3" style="font-size: 12px;"><h:outputText
																value="#{transaccionBovedaBean.voucherBovedaView.denominacionTipomoneda} (#{transaccionBovedaBean.voucherBovedaView.abreviaturaTipomoneda})" /></td>
													</tr>
													<tr style="vertical-align: center;">
														<td colspan="1"
															style="font-weight: bold; font-size: 12px;"><h:outputText
																value="TIPO TRANS.:" /></td>
														<td colspan="3" style="font-size: 12px;"><h:outputText
																value="#{transaccionBovedaBean.voucherBovedaView.denominacionTipotransaccion}" />
														</td>
													</tr>
													<tr>
														<td colspan="1"
															style="font-weight: bold; font-size: 12px;">TIPO
															ENTIDAD:</td>
														<td colspan="3" style="font-size: 12px;"><h:outputText
																value="#{transaccionBovedaBean.voucherBovedaView.tipoentidadTransaccionboveda}" /></td>
													</tr>
													<tr>
														<td colspan="1"
															style="font-weight: bold; font-size: 12px;">ENTIDAD:</td>
														<td colspan="3" style="font-size: 12px;"><h:outputText
																value="#{transaccionBovedaBean.voucherBovedaView.denominacionEntidad}" /></td>
													</tr>
													<tr>
														<td colspan="1"
															style="font-weight: bold; font-size: 12px;">OBS.:</td>
														<td colspan="3" style="font-size: 12px;"><h:outputLabel
																value="#{transaccionBovedaBean.transaccionboveda.observacion}" />
														</td>
													</tr>
													<tr>
														<td colspan="4">&nbsp;</td>
													</tr>
													<tr>
														<td colspan="4">
															<table
																style="width: 298px; border: solid 1px #E9E6E6; margin-bottom: 0px; margin: 0 auto;">
																<thead>
																	<tr>
																		<th><label
																			style="font-weight: bold; font-size: 12px;">
																				DENOMINACION</label></th>
																		<th><label
																			style="font-weight: bold; font-size: 12px;">
																				CANTIDAD</label></th>
																		<th><label
																			style="font-weight: bold; font-size: 12px;">
																				TOTAL</label></th>
																	</tr>
																</thead>
																<tbody>
																	
																	<ui:repeat
																		value="#{transaccionBovedaBean.voucherDetalleTransaccionBovedaView}"
																		var="voucherBoveda">
																		<h:panelGroup
																			rendered="#{voucherBoveda.cantidad == 0 ? false : true}">
																			<tr class="ng-scope">
																				<td><h:outputLabel
																						value="#{voucherBoveda.denominacionmoneda.denominacion}" /></td>
																				<td><h:outputLabel
																						value="#{voucherBoveda.cantidad}" /></td>
																				<td><h:outputLabel
																						value="#{voucherBoveda.subtotal}" /></td>
																			</tr>
																		</h:panelGroup>
																	</ui:repeat>
																	
																</tbody>
															</table>
														</td>
													</tr>

													<tr>
														<td colspan="2"
															style="font-weight: bold; font-size: 12px;">TOTAL
															TRANSACCION:</td>
														<td colspan="2" style="font-size: 12px; text-align: center;"><h:outputText
																value="#{transaccionBovedaBean.voucherBovedaView.abreviaturaTipomoneda} #{transaccionBovedaBean.voucherBovedaView.totalTransaccion}" /></td>
													</tr>
													<tr>
														<td colspan="2"
															style="font-weight: bold; font-size: 12px;">TOTAL
															DISPONIBLE EN BOVEDA:</td>
														<td colspan="2" style="font-size: 12px; text-align: center;"><h:outputText
																value="#{transaccionBovedaBean.voucherBovedaView.abreviaturaTipomoneda} #{transaccionBovedaBean.voucherBovedaView.saldodisponibleTransaccionboveda}" /></td>
													</tr>
													<tr>
														<td colspan="4">&nbsp;</td>
													</tr>
													<tr>
														<td colspan="4">&nbsp;</td>
													</tr>
													<h:panelGroup rendered="#{transaccionBovedaBean.isCaja()}">
														<tr>
															<td colspan="2" style="text-align: center;">------------------------------</td>
															<td colspan="2" style="text-align: center;">------------------------------</td>
														</tr>
														<tr>
															<td colspan="2"
																style="text-align: center; font-weight: bold; font-size: 12px;">JEFE
																DE CAJA</td>
															<td colspan="2"
																style="text-align: center; font-weight: bold; font-size: 12px;">CAJERO</td>
														</tr>
													</h:panelGroup>
													<h:panelGroup
														rendered="#{transaccionBovedaBean.isAgencia()}">
														<tr>
															<td colspan="2" style="text-align: center;">--------------------------------------</td>
															<td colspan="2" style="text-align: center;">--------------------------------------</td>
														</tr>
														<tr>
															<td colspan="2"
																style="text-align: center; font-weight: bold; font-size: 12px;">JEFE DE CAJA #{agenciaBean.agencia.abreviatura}</td>
															<td colspan="2"
																style="text-align: center; font-weight: bold; font-size: 12px;">JEFE DE
																CAJA #{transaccionBovedaBean.comboAgencia.objectItemSelected.abreviatura}</td>
														</tr>
													</h:panelGroup>
													<h:panelGroup rendered="#{transaccionBovedaBean.isOtro()}">
														<tr>
															<td colspan="2" style="text-align: center;">------------------------------------------</td>
															<td colspan="2" style="text-align: center;">----------------------------------------</td>
														</tr>
														<tr>
															<td colspan="2" 
																style="text-align: center; font-weight: bold; font-size: 12px;">ADMINISTRADOR #{agenciaBean.agencia.abreviatura}</td>
															<td colspan="2"
																style="text-align: center; font-weight: bold; font-size: 12px;">JEFE DE CAJA #{agenciaBean.agencia.abreviatura}</td>
														</tr>
													</h:panelGroup>
												</table>
											</h:panelGroup>
										</div>
									</div>
									<div style="margin-left: 280px;">
										<h:commandButton value="Imprimir" styleClass="action green">
											<p:printer target="voucherBoveda" />
										</h:commandButton>
										<h:commandButton value="Salir"
											action="transaccion?faces-redirect=true" />
									</div>
								</div>
							</h:panelGroup>

							<p:focus for="cmbBoveda" />
							<h:panelGroup rendered="#{!transaccionBovedaBean.success}">
								<div class="p6n-api-consent-screen-inputs">
									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label"
											style="width: 150px;">BOVEDA</div>
										<div>
											<h:selectOneMenu id="cmbBoveda"
												value="#{transaccionBovedaBean.comboBoveda.itemSelected}"
												valueChangeListener="#{transaccionBovedaBean.changeBoveda}"
												required="true" requiredMessage="Seleccione una Boveda">
												<f:selectItem itemLabel="--Seleccione--" itemValue="" />
												<f:selectItems
													value="#{transaccionBovedaBean.comboBoveda.items.entrySet()}"
													var="val" itemLabel="#{val.value.denominacion}"
													itemValue="#{val.key}" />
												<f:ajax
													render="panelDetalletransaccion cmbTipoEntidad panelOrigen"
													execute="@this" />
											</h:selectOneMenu>
										</div>
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="cmbBoveda" />
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label"
												style="width: 150px;">TIPO TRANSACCION</div>
											<div>
												<h:selectOneMenu id="cmbTipoTransaccion"
													value="#{transaccionBovedaBean.comboTipotransaccion.itemSelected}"
													valueChangeListener="#{transaccionBovedaBean.changeTipotransaccion}"
													required="true"
													requiredMessage="Seleccione un Tipo de Transaccion">
													<f:selectItem itemLabel="--Seleccione--" itemValue="" />
													<f:selectItems
														value="#{transaccionBovedaBean.comboTipotransaccion.items.entrySet()}"
														var="val" itemLabel="#{val.value.denominacion}"
														itemValue="#{val.key}" />
													<f:ajax render="panelOrigen" execute="@this" />
												</h:selectOneMenu>
											</div>
										</div>
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label"
												style="width: 150px;">TIPO ENTIDAD</div>
											<div>
												<h:selectOneMenu id="cmbTipoEntidad"
													value="#{transaccionBovedaBean.comboTipoentidad.itemSelected}"
													valueChangeListener="#{transaccionBovedaBean.changeTipoentidad}"
													required="true"
													requiredMessage="Seleccione el Tipo de Entidad que realiza la Transaccion">
													<f:selectItem itemLabel="--Seleccione--" itemValue="" />
													<f:selectItems
														value="#{transaccionBovedaBean.comboTipoentidad.items.entrySet()}"
														var="val" itemLabel="#{val.value}" itemValue="#{val.key}" />
													<f:ajax render="panelOrigen" execute="@this" />
												</h:selectOneMenu>
											</div>
										</div>
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label"
												style="width: 150px;">ENTIDAD</div>
											<h:panelGroup id="panelOrigen">
												<h:selectOneMenu id="cmbEntidad"
													rendered="#{(!transaccionBovedaBean.isCaja()) and (!transaccionBovedaBean.isOtro()) and (!transaccionBovedaBean.isAgencia())}"
													required="true" requiredMessage="Seleccione una Entidad">
													<f:selectItem itemLabel="--Seleccione--" itemValue="" />
												</h:selectOneMenu>
												<h:selectOneMenu id="cmbCaja"
													value="#{transaccionBovedaBean.comboCaja.itemSelected}"
													rendered="#{transaccionBovedaBean.isCaja()}"
													required="true" requiredMessage="Seleccione una caja">
													<f:selectItem itemLabel="--Seleccione--" itemValue="" />
													<f:selectItems
														value="#{transaccionBovedaBean.comboCaja.items.entrySet()}"
														var="val" itemLabel="#{val.value.denominacion}"
														itemValue="#{val.key}" />
													<f:ajax render="panelOrigen" execute="@this" />
												</h:selectOneMenu>
												<h:selectOneMenu id="cmbAgencia"
													value="#{transaccionBovedaBean.comboAgencia.itemSelected}"
													rendered="#{transaccionBovedaBean.isAgencia()}"
													required="true" requiredMessage="Seleccione una agencia">
													<f:selectItem itemLabel="--Seleccione--" itemValue="" />
													<f:selectItems
														value="#{transaccionBovedaBean.comboAgencia.items.entrySet()}"
														var="val" itemLabel="#{val.value.denominacion}"
														itemValue="#{val.key}" />
													<f:ajax render="panelOrigen" execute="@this" />
												</h:selectOneMenu>
												<h:selectOneMenu id="cmbEntidadfinanciera"
													value="#{transaccionBovedaBean.comboEntidadfinanciera.itemSelected}"
													rendered="#{transaccionBovedaBean.isOtro()}"
													required="true"
													requiredMessage="Seleccione una Entidad Financiera">
													<f:selectItem itemLabel="--Seleccione--" itemValue="" />
													<f:selectItems
														value="#{transaccionBovedaBean.comboEntidadfinanciera.items.entrySet()}"
														var="val" itemLabel="#{val.value.denominacion}"
														itemValue="#{val.key}" />
													<f:ajax render="panelOrigen" execute="@this" />
												</h:selectOneMenu>
											</h:panelGroup>
										</div>
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="cmbTipoTransaccion" />
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="cmbTipoEntidad" />
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="cmbEntidad" />
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="cmbCaja" />
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="cmbEntidadfinanciera" />
									</div>


									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label"
											style="width: 150px;">OBSERVACION</div>
										<div>
											<h:inputText size="61"
												value="#{transaccionBovedaBean.transaccionboveda.observacion}" />
										</div>
									</div>


									<div class="sf-separator"></div>
									<div class="p6n-api-consent-screen-input-section">
										<div>
											<h:panelGroup id="panelDetalletransaccion">
												<div style="display: inline-block; vertical-align: top;">
													
													<table>
														<thead>
															<tr>
																<td style="text-align: right;">
																	<div class="p6n-api-consent-screen-label"
																		style="width: 100px;">DENOMINACION</div>
																</td>
																<td style="width: 20px;"></td>
																<td><div class="p6n-api-consent-screen-label"
																		style="width: 150px;">CANTIDAD</div></td>
																<td style="width: 20px;"></td>
																<td><div class="p6n-api-consent-screen-label"
																		style="width: 110px;">TOTAL</div></td>
															</tr>
														</thead>
														<tbody>
															<ui:repeat
																value="#{transaccionBovedaBean.tablaDetalletransaccionboveda.rows}"
																var="detalle">
																
																<tr>
																	<td style="text-align: right; vertical-align: middle;"><h:outputLabel
																			value="#{detalle.denominacionmoneda.denominacion}" /></td>
																	<td></td>
																	<td><h:inputText value="#{detalle.cantidad}"
																			required="true" maxlength="6"
																			styleClass="jfk-textinput p6n-api-consent-screen-homepage-url label-input-label"
																			style="width:150px;">
																			<f:ajax event="blur"
																				render="txtTotal :formTransaccion:panelTotalTransaccion" />
																		</h:inputText></td>
																	<td></td>
																	<td><h:outputLabel id="txtTotal"
																			value="#{transaccionBovedaBean.comboBoveda.objectItemSelected.tipomoneda.abreviatura} #{detalle.getSubtotal()}"
																			style="width: 110px; vertical-align: middle;" /></td>
																</tr>
																
															</ui:repeat>
														</tbody>
													</table>
												</div>
												<div style="display: inline-block; width: 20px;"></div>
												<div
													style="display: inline-block; vertical-align: top; border: 1px solid; border-color: #C5C5C5;">
													<table>
														<thead>
															<tr>
																<td style="text-align: right;">
																	<div class="p6n-api-consent-screen-label"
																		style="width: 100px;">DENOMINACION</div>
																</td>
																<td style="width: 20px;"></td>
																<td><div class="p6n-api-consent-screen-label"
																		style="width: 150px;">CANTIDAD DISPONIBLE</div></td>
																<td style="width: 20px;"></td>
															</tr>
														</thead>
														<tbody>
															<ui:repeat
																value="#{transaccionBovedaBean.tablaDetallehistorialboveda.rows}"
																var="detalle">
																<tr style="height: 34px;">
																	<td style="text-align: right; vertical-align: middle;"><h:outputLabel
																			value="#{detalle.denominacionmoneda.denominacion}" /></td>
																	<td></td>
																	<td style="vertical-align: middle;"><h:outputLabel
																			value="#{detalle.cantidad}" /></td>
																	<td></td>
																</tr>
															</ui:repeat>
														</tbody>
													</table>
												</div>
											</h:panelGroup>
										</div>
									</div>
									<div class="p6n-api-consent-screen-input-section"
										style="margin-left: 20px;">
										<h:panelGroup id="panelTotalTransaccion">
											<div>
												<div class="p6n-api-consent-screen-label"
													style="width: 150px;">TOTAL TRANSACCION</div>
												<div>
													<h:outputLabel id="txtTotaltransaccion"
														value=" #{transaccionBovedaBean.comboBoveda.objectItemSelected.tipomoneda.abreviatura} #{transaccionBovedaBean.getTotalTransaccion()}">
													</h:outputLabel>
												</div>
											</div>
										</h:panelGroup>
									</div>
									<div class="sf-separator"></div>
									<div class="sf-buttons" style="float: left;">

										<h:commandButton
											action="#{transaccionBovedaBean.createTransaccionboveda()}"
											value="Aceptar" styleClass="action green" />
										<h:commandButton
											action="/jefeCaja/boveda/administracion/list?faces-redirect=true"
											value="Cancelar" styleClass="action" immediate="true" />
									</div>
								</div>
							</h:panelGroup>
						</div>
					</div>
				</div>
			</h:form>
		</ui:define>

	</ui:composition>
</f:view>
</html>
